"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var BaseDao_1 = require('./BaseDao');
var Token_1 = require('../models/Token');
var TokensDao = (function (_super) {
    __extends(TokensDao, _super);
    function TokensDao() {
        _super.call(this);
        this.tokenModel = this.dbManager.getModel("mToken");
    }
    TokensDao.prototype.add = function (userId, callback) {
        var token = new Token_1.Token();
        token.user = userId;
        var token_ = new this.tokenModel(token);
        token_.save(callback);
    };
    TokensDao.prototype.get = function (tokenStr, callback) {
        this.tokenModel.findOne({ _id: tokenStr }).populate('user').exec(callback);
    };
    return TokensDao;
}(BaseDao_1.BaseDao));
exports.TokensDao = TokensDao;
